/* 
 * Created by kenterZheng on Tue Jun 04 2024 17:30:40
 *
 */

import moment from 'moment';
import { environment } from '../models/environment';


/**
 * 日期格式化
 * @param {date} date --日期格式
 * @param {string} format --格式化格式，默认YYYY-MM-DD'
 * @param {string} innerFormat --入参格
 */
const date = (date, format, innerFormat) => {
  innerFormat = innerFormat || '';
  format = format || 'YYYY-MM-DD';
  return date ? moment(date, innerFormat).format(format) : '';
};


const fileUrl = (filename) => {
  let result = environment.API_URL + '/upload/' + filename;
  return result;
};

const filePath = (filename) => {
  console.log('filePath -> environment.FILE_PATH', environment.FILE_PATH);
  let result = environment.FILE_PATH + filename;
  return result;
};


export default {
  date,
  fileUrl,
  filePath,
};
